package com.ws.boot.demo.validate.entity;

import com.ws.boot.demo.validate.validation.annotation.Unique;
import com.ws.boot.demo.validate.validation.groups.Delete;
import com.ws.boot.demo.validate.validation.groups.Insert;
import com.ws.boot.demo.validate.validation.groups.Update;
import com.ws.boot.validate.annotation.constraint.Checker;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;

/**
 * 身份证 .
 *
 * @className: IdCard
 * @author: ws
 * @date: 2020/4/1 14:18
 * @version: 1.0.0
 */
@Accessors(chain = true)
@Data
public class IdCard5 extends BaseEntity {

    /**
     * 真实姓名
     */
    @NotBlank(groups = {Insert.class, Delete.class})
    private String realName;

    /**
     * 编码
     */
    @NotBlank
    @Pattern(regexp = "^\\w{5,10}$", groups = {Insert.class})
    @Unique(groups = {Update.class})
    private String code;

    /**
     * 身份证详情
     */
    @Checker(groups = {Update.class})
    private IdCardDetail5 idCardDetail5;
}
